package org.codeart.springdemo.config;

import org.codeart.springdemo.pojo.Friends;
import org.codeart.springdemo.pojo.User;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;
import java.util.List;

@Configuration
@ComponentScan("org.codeart.springdemo")
public class AppConfig {
    
    @Bean("user01")
    public User user01() {
        User user = new User();
        user.setId(888);
        user.setName("洛必达");
        Friends friends = new Friends();
        List<String> names = new ArrayList<String>() {{
            add("伯努利");
            add("高斯");
            add("欧拉");
        }};
        friends.setNames(names);
        user.setFriends(friends);
        return user;
    }

}
